/** 项目路由配置文件 */

import { KeepAlive } from "vue";
import { createRouter, createWebHashHistory } from "vue-router";


//路由表配置
const routesList = [
    {
        path:"/",
        redirect:"/home"
    },
    {
        path:'/home',
        name:"Home",
        component:()=>import("@/views/home/home.vue"),
        meta:{
            keepAlive:true
        }
    },
    {
        path:"/category",
        name:"Ctegory",
        component:() => import("@/views/category/category.vue"),
        meta:{
            keepAlive:true
        }
    },
    {
        path:"/cart",
        name:"Cart",
        component: () => import("@/views/cart/cart.vue"),
        meta:{
            keepAlive:true
        }
    },
    {
        path:"/mine",
        name:"Mine",
        component: () => import("@/views/mine/mine.vue"),
        meta:{
            keepAlive:true
        }
    },
    {
        path:"/login",
        name:"Login",
        component: () => import("@/views/login/login.vue"),
        meta:{
            KeepAlive:false
        }
    }
]

const router = createRouter({
    history:createWebHashHistory(),
    routes:routesList,
    scrollBehavior(){
        return {
            left:0,
            top:0
        }
    }
});

export default router;